<<<<<<< .mine
<?php
if(@$_POST['open'] != 'please'){
	exit;
}
include_once("../../php/include_all.php");
?>
<div class="row-fluid">
	<div class="span12">
		<h3 class="page-title">
            <b>Pembiayaan SPM</b>
        </h3>
		<div class="widget">
			<div class="widget-title" style="margin-top: 20px;">
                <h4><i class="icon-reorder"></i>Pembiayaan SPM</h4>
                <span class="tools">
                    <a href="javascript:;" class="icon-chevron-down"></a>
                </span>
            </div>
			<div class="widget-body form">
				<form method="POST" action="" class="form-horizontal">
					<input type="hidden" name="act" value="">
					<input type="hidden" id="" name="" value="0">
					<div class="control-group">
                        <label class="control-label">Tahun Anggaran</label>
                        <div class="controls">
                            <select name="id_tahun" id="id_tahun">
								<option id="awal">Pilih salah satu</option>
								<?php
									$tahun = get_datas('SELECT t.thn_angg FROM spm_thn_angg t, spm_jenis_pelayanan j WHERE t.id_thn_angg = j.id_thn_angg');
									foreach($tahun as $tahun){
								?>
									<option value="<?php echo $tahun['id_thn_angg'] ?>"><?php echo $tahun['thn_angg'] ?></option>
								<?php
								}
								?>
							</select>
                        </div>
					</div>
					<div class="control-group">
                        <label class="control-label">Pelayanan</label>
                        <div class="controls">
                            <select name="id_pelayanan" id="id_pelayanan">
								<option id="awal">Pilih salah satu</option>
								<?php
									$pelayanan = get_datas('SELECT * FROM spm_jenis_pelayanan');
									foreach($pelayanan as $pelayanan){
								?>
									<option value="<?php echo $pelayanan['id_pelayanan'] ?>"><?php echo $pelayanan['nama_pelayanan'] ?></option>
								<?php
								}
								?>
							</select>
                        </div>
					</div>
					<div class="control-group">
                        <label class="control-label">Indikator</label>
                        <div class="controls">
                            <select name="id_indikator" id="id_indikator">
								<option id="awal">Pilih salah satu</option>
							</select>
                        </div>
					</div>
					<div class="control-group">
                        <label class="control-label">Kegiatan</label>
                        <div class="controls">
                            <select name="id_kegiatan" id="id_kegiatan">
								<option id="awal">Pilih salah satu</option>
							</select>
                        </div>
					</div>
					<div class="control-group">
                        <label class="control-label">Sub Kegiatan</label>
                        <div class="controls">
                            <select name="id_subkegiatan" id="id_subkegiatan">
								<option id="awal">Pilih salah satu</option>
							</select>
                        </div>
					</div>
					<div class="form-actions">
                        <button type="submit" class="btn btn-primary">Save</button>
                        <button type="button" class="btn">Cancel</button>
                    </div>
				</form>
			</div>
		</div>
	</div>
</div>
<script type="text/javascript" src="../assets/data-tables/jquery.dataTables.js"></script>
<script type="text/javascript" src="../assets/data-tables/DT_bootstrap.js"></script>
<script>

var urls = 'master_pembiayaan/pembiayaan_action.php';

    jQuery(document).ready(function() {
         // initiate layout and plugins
        App.init();
    });
	
	$('#id_pelayanan').change(function(){
	var post = $.post(urls,{act:'get_pelayanan',idpel:this.value});
		post.done(function(data){
			$('#id_indikator').html(data);
		});
	});
	
	$('#id_indikator').change(function(){
	var post = $.post(urls,{act:'get_indikator',idind:this.value});
		post.done(function(data){
			$('#id_kegiatan').html(data);
		});
	});
	
	$('#id_kegiatan').change(function(){
	var post = $.post(urls,{act:'get_kegiatan',idkeg:this.value});
		post.done(function(data){
			$('#id_subkegiatan').html(data);
		});
	});
</script>=======
<?php
include_once("../../php/include_all.php");
?>
<div class="row-fluid">
	<div class="span12">
		<h3 class="page-title">
            <b>Data Kegiatan</b>
        </h3>
		       <a href="#modalwin" data-toggle="modal" class="btn btn-primary btn-tambah">Tambah P</a>
        <div id="modalwin" class="modal hide fade" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">

             <header class="modal-header">
			<a href="#" class="close geo-clear" data-dismiss="modal">x</a>
                <h3>Data Kegiatan</h3>
            </header>
            <div class="modal-body">
              <form id="form_kegiatan"  class="form-horizontal">
					<input type="hidden" name="act" value="kegiatan_action">
					<input type="hidden" id="id_kegiatan" name="id_kegiatan" value="0">
					<div class="control-group">
                        <label class="control-label">Indikator</label>
                        <div class="controls">
                            <select name="id_indikator" id="id_indikator">
								<option id="id_ind" value="0">Pilih salah satu</option>
								<?php
									$ind = get_datas("SELECT * FROM spm_indikator order by id_indikator");
									foreach($ind as $ind){
								?>
									<option value=<?php echo $ind['id_indikator']; ?>><?php echo $ind['nama_indikator']; ?></option>
								<?php
								}
								?>
							</select>
                        </div>
					</div>
					<div class="control-group">
                        <label class="control-label">Kode Kegiatan</label>
                        <div class="controls">
                            <input type="text" id="kode_kegiatan" name="kode_kegiatan" class="input-small" readonly />
                        </div>
					</div>
					<div class="control-group">
                        <label class="control-label">Nama Kegiatan</label>
                        <div class="controls">
                            <input type="text" id="nama_kegiatan" name="nama_kegiatan" class="input-xlarge" />
                        </div>
					</div>
                      <a class="btn btn-primary bt-simpan-kegiatan"><div id="loader" style="margin-top:2px"></div>&nbsp;Save</a>
                                <span id="result"></span>
				</form>
            </div>
		</div>
	</div>
	</div>
	</br>
	<div class="row-fluid">
        <div class="span12">
			<div class="widget" style="">
                <div class="widget-title">
                    <h4><i class="icon-reorder"></i>Tabel Kegiatan</h4>
                    <span class="tools">
                        <a href="javascript:;" class="icon-chevron-down"></a>
                    </span>
                </div>
				<div class="widget-body">
                    <table class="table table-striped table-bordered" id="sample_1">
                    <thead>
                        <tr>
                            <th class="hidden-phone" style="width:20px; text-align:center;">No</th>
                            <th style="text-align:center;">Kode Indikator</th>
                            <th style="text-align:center;">Nama Indikator</th>
                            <th style="text-align:center;">Kode Kegiatan</th>
                            <th style="text-align:center;">Nama Kegiatan</th>
							<th style="text-align:center;">Edit</th>
                        </tr>
                    </thead>
                    <tbody id="tb-kegiatan">
					<?php 
					$no=1;
					$keg = get_datas("SELECT * FROM spm_kegiatan k,spm_indikator i WHERE k.id_indikator=i.id_indikator order by k.id_kegiatan");
					foreach ($keg as $keg){
					?>
						<tr>
							<td><?php echo $no ?></td>
							<td><?php echo $keg['kode_indikator'];?></td>
							<td><?php echo $keg['nama_indikator']?></td>
							<td><?php echo $keg['kode_kegiatan']?></td>
							<td><?php echo $keg['nama_kegiatan']?></td>
							<td style="width:200px; text-align:center;">
							<a class="btn btn-danger bt-delete-kegiatan" name="<?php echo $keg['id_kegiatan']; ?>">Delete</a>
                                <a  href="#modalwin" data-toggle="modal"  class="btn btn-info bt-edit-kegiatan" name="<?php echo $keg['id_kegiatan']; ?>">Edit</a>
							</td>
						</tr>
						<?php 
						$no++;
						}
						?>
					</tbody>
				</div>
			</div>
		</div>
	</div>
</div>
<script type="text/javascript" src="../assets/data-tables/jquery.dataTables.js"></script>
<script type="text/javascript" src="../assets/data-tables/DT_bootstrap.js"></script>
<script>
    jQuery(document).ready(function() {       
         // initiate layout and plugins
        App.init();
    });
</script>

<script>
var urls = 'master_kegiatan/kegiatan_action.php';

$('#id_indikator').change(function(){
    source ="master_kegiatan/id.php?idk="+this.value;
    var coba=$.get(source);
    coba.done(function(res){          
        document.getElementById('kode_kegiatan').value=res;	
    })
});
	
$('.bt-simpan-kegiatan').click(function(){
	var btn  = $(this);
	var load = $('#loader');
	var rslt = $('#result');
	load.addClass('spinner pull-left');
	btn.removeClass('btn-primary').addClass('btn-info');
	
	var form = $('#form_kegiatan');
	var data = form.serializeArray();
	var post = $.post(urls,data);
	post.done(function(res){
		var result = res.split('__');
		//   0      1     2
		//success__id__(isi tbody)tr
		if(result.length==3){
			if(result[0]=='success'){
				rslt.html('<font color="green">tersimpan...</font>');
				setTimeout(function(){
					rslt.html('');
				},1500);
				var tbody = $('#tb-kegiatan');
				tbody.html(result[2]);
				document.getElementById('form_kegiatan').reset();
				 //$('#thn_angg').val(' ');
				init();
			}else{
				rslt.html('<font color="red">'+res+'</font>');
			}
		}else{
			rslt.html('<font color="red">'+res+'</font>');
		}
		load.removeClass();
		btn.removeClass('btn-info').addClass('btn-primary');
	});
});
	
function init(){
$('.bt-delete-kegiatan').click(function(){
			var btn = $(this);
			var pid = this.name;
			var load = $(this);
			bootbox.confirm("Anda akan menghapus data ini?", function(result) {
                if(result==true){
                    if(pid!=0){
                        var post = $.post(urls,{act:'del_kegiatan',id_kegiatan:pid});
                        post.done(function(res){
                            var hasil = res.split('__');
						if(hasil.length==2){
							if(hasil[0] == 'success'){
								var tbody = $('#tb-kegiatan');
								tbody.html(hasil[1]);
								init();
									}
								}
                        });
                        load.html('Delete');
                    }
                }else{
                    load.html('Delete');
                }
            });
		});
	
	$('.bt-edit-kegiatan').click(function(){
		var id_kegiatan = this.name;
		var form = $('#form_kegiatan');
		var post = $.post(urls,{act:'edit_kegiatan',id_kegiatan:id_kegiatan});
		post.done(function(res){
			var value = res.split('__');
			$('#id_kegiatan').val(value[0]);
                form.find('select[name="id_indikator"]').val(value[1]); 
				form.find('input[name=kode_kegiatan]').val(value[2]);
                form.find('input[name="nama_kegiatan"]').val(value[3]);
		});
	});
}

$('.geo-clear').click(function(){
	$('#id_kegiatan').val(0);
	document.getElementById('form_kegiatan').reset();
});
init();
</script>>>>>>>> .r28
